﻿package mortal.game.view.common
{
    import com.mui.controls.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.display.*;

    public class ActionBaseTimerBox extends GSprite
    {
        private var _doubleCountDown:SecTimerBitmapView;
        private var stateImg:GImageBitmap;

        public function ActionBaseTimerBox()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.gBitmap(ImagesConst.ActiveTimeBg, 0, 0, this));
            this._doubleCountDown = UIFactory.secTimerBitmapView(0, 4, "", 10, 11, -3, this, 10, BitmapNumberText.Left);
            this._doubleCountDown.customCharIndex = {0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, ::10};
            this._doubleCountDown.setParse("mm:ss");
            this.stateImg = UIFactory.gImageBitmap("", 35.5, 2, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._doubleCountDown.dispose(param1);
            this._doubleCountDown = null;
            this.stateImg.dispose(param1);
            this.stateImg = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public function set leftTime(param1:int) : void
        {
            this._doubleCountDown.setLeftTime(param1);
            return;
        }// end function

        public function set stateImageUrl(param1:String) : void
        {
            this.stateImg.imgUrl = "";
            this.stateImg.imgUrl = param1;
            if (param1)
            {
                this._doubleCountDown.x = 1;
            }
            else
            {
                this._doubleCountDown.x = (this.width - this._doubleCountDown.width) * 0.5;
            }
            return;
        }// end function

        public function set stateImageXPos(param1:int) : void
        {
            this.stateImg.x = param1;
            return;
        }// end function

        public function set numberTxtUrl(param1:String) : void
        {
            this._doubleCountDown.setSytleName(param1, 10, 11, -3, 10);
            return;
        }// end function

        public function get leftTime() : int
        {
            return this._doubleCountDown.getLeftTime();
        }// end function

        public function get currentTimeStr() : String
        {
            return this._doubleCountDown.text;
        }// end function

        public function setParse(param1:String) : void
        {
            this._doubleCountDown.setParse(param1);
            return;
        }// end function

        public function set timeUpdateCaller(param1:Function) : void
        {
            this._doubleCountDown.caller = param1;
            return;
        }// end function

        public function set timeOutCaller(param1:Function) : void
        {
            this._doubleCountDown.timeOutHandler = param1;
            return;
        }// end function

    }
}
